<?php 
session_start();include "conn.php";
?>
<?php  include("admin.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Bios 管理中心 </title>
<link href="../css/control.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {color: #000000}
-->
</style>
</head>

<body>
<a name="top" id="top"></a>
<div id="all"><!--Wrap start //-->
<div id="main" class="clearfix"><!--main start //-->
<div id="top-1"><?php include_once('blog_top_btn.php');?>
</div>
<!--Content for  id "submenu" Goes Here //-->
<div id="submenu">
<?php include_once('admin_main_btn.php');?>
  </div>
 <!--Content for  id "contact" Goes Here //-->
 <div id="contact-admin">
   
	  
	  
	  
	  
	  
	  
	  <?php 
//修改数据
$deltype=make_safe($_GET["deltype"]);
$mastername=make_safe($_GET["mastername"]);
$salename=make_safe($_GET["salename"]);
$id=make_safe($_GET["id"]);
$box1=make_safe($_GET["box1"]);
$box2=make_safe($_GET["box2"]);
$box3=make_safe($_GET["box3"]);
$box4=make_safe($_GET["box4"]);
$box5=make_safe($_GET["box5"]);
$box6=make_safe($_GET["box6"]);
$box7=make_safe($_GET["box7"]);
$box8=make_safe($_GET["box8"]);
$box9=make_safe($_GET["box9"]);

$a1=make_safe($_GET["a1"]);
$a2=make_safe($_GET["a2"]);
$a3=make_safe($_GET["a3"]);
$a4=make_safe($_GET["a4"]);
$a5=make_safe($_GET["a5"]);
$a6=make_safe($_GET["a6"]);
$a7=make_safe($_GET["a7"]);
$a8=make_safe($_GET["a8"]);
$a9=make_safe($_GET["a9"]);
include("check.php");


if($id!="" and $box1!=""){
$query=mysql_query("update guanli set box1='$box1' where id='$id'");
}
if($id!="" and $box2!=""){
$query=mysql_query("update guanli set box2='$box2' where id='$id'");
}
if($id!="" and $box3!=""){
$query=mysql_query("update guanli set box3='$box3' where id='$id'");
}
if($id!="" and $box4!=""){
$query=mysql_query("update guanli set box4='$box4' where id='$id'");
}
if($id!="" and $box5!=""){
$query=mysql_query("update guanli set box5='$box5' where id='$id'");
$query=mysql_query("update guanli set box7='0',mastersalename='',salename='',b1='0',b2='0',b3='0',b4='0',b5='0',b6='0',b7='0' where    box7='1'  and  mastersalename='$mastername'   ");
$query=mysql_query("update guanli set box6='0',mastersalename='' where box6='1' and  mastersalename='$mastername'   ");
}
if($id!="" and $box6!=""){
$query=mysql_query("update guanli set box7='0',mastersalename='',salename='',b1='0',b2='0',b3='0',b4='0',b5='0',b6='0',b7='0' where    box7='1'  and  salename='$salename'    ");
$query=mysql_query("update guanli set box6='$box6' where id='$id'");
}
if($id!="" and $box7!=""){
$query=mysql_query("update guanli set box7='$box7' where id='$id'");
}
if($id!="" and $box8!=""){
$query=mysql_query("update guanli set box8='$box8' where id='$id'");
}
if($id!="" and $box9!=""){
$query=mysql_query("update guanli set box9='$box9' where id='$id'");
}

if($id!="" and $a1!=""){
$query=mysql_query("update guanli set a1='$a1' where id='$id'");
}
if($id!="" and $a2!=""){
$query=mysql_query("update guanli set a2='$a2' where id='$id'");
}
if($id!="" and $a3!=""){
$query=mysql_query("update guanli set a3='$a3' where id='$id'");
}
if($id!="" and $a4!=""){
$query=mysql_query("update guanli set a4='$a4' where id='$id'");
}
if($id!="" and $a5!=""){

$query=mysql_query("update guanli set a5='$a5' where id='$id'");
}
if($id!="" and $a6!=""){
	
$query=mysql_query("update guanli set a6='$a6' where id='$id'");
}
if($id!="" and $a7!=""){
$query=mysql_query("update guanli set a7='$a7' where id='$id'");
}
if($id!="" and $a8!=""){
$query=mysql_query("update guanli set a8='$a8' where id='$id'");
}
if($id!="" and $a9!=""){
$query=mysql_query("update guanli set a9='$a9' where id='$id'");
}
?>
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  	<?php
	
	$id=make_safe($_GET["id"]);
$action=make_safe($_GET["action"]);
$deltype=make_safe($_GET["deltype"]);
$mastername=make_safe($_GET["mastername"]);
	if ($action=="del" and $deltype=="master"){
	
		if($id!=""){
		
$query=mysql_query("update guanli set box7='0',mastersalename='',salename='',b1='0',b2='0',b3='0',b4='0',b5='0',b6='0',b7='0' where    box7='1'  and  mastersalename='$mastername'   ");


		
$query=mysql_query("update guanli set box6='0',mastersalename='' where box6='1' and  mastersalename='$mastername'   ");

	
	$sql="Delete from guanli  where id='".$id."' ";
			$result=mysql_query($sql);
			
			echo "<script>window.location.href='admin-acc-s-main.php';</script>";
	
	
			
		}
	}
?>



	

	  <?php
	
	$id=make_safe($_GET["id"]);
$action=make_safe($_GET["action"]);
$deltype=make_safe($_GET["deltype"]);
$salename=make_safe($_GET["salename"]);

	if ($action=="del" and $deltype=="sale"){	
		if($id!=""){		
$query=mysql_query("update guanli set box7='0',mastersalename='',salename='',b1='0',b2='0',b3='0',b4='0',b5='0',b6='0',b7='0' where    box7='1'  and  salename='$salename'    ");	
		$sql="Delete from guanli  where id='".$id."' ";
		$result=mysql_query($sql);			
		echo "<script>window.location.href='admin-acc-s-main.php';</script>";
		}
	}
	?>
	  
	  
	  
	  
	  
	<?php
	
	$id=make_safe($_GET["id"]);
$action=make_safe($_GET["action"]);
$deltype=make_safe($_GET["deltype"]);
	if ($action=="del" and $deltype=="design"){	
		if($id!=""){		
			$sql="Delete from guanli  where id in (".$id.")";
			$result=mysql_query($sql);			
			echo "<script>window.location.href='admin-acc-s-main.php';</script>";
		}
	}
	?> 
	  
	  
	  
	  
	  <table width="600" border="0" cellpadding="0" cellspacing="1"  >
        
        <tr bgcolor="#9E6401" > 
          <td width="182" height="25" align="center"><span class="STYLE1">帳號</span></td>
          <td width="141" align="center"><span class="STYLE1">密碼</span></td>
          <td width="123" align="center"><span class="STYLE1">master sale </span></td>
          <td width="116" align="center"><span class="STYLE1">sale</span></td>
          <td width="128" align="center"><span class="STYLE1">design</span></td>
          <td width="103" height="20" align="center"><span class="STYLE1">操作</span></td>
        </tr>
        <?php 
		 
   if($page){
    $page_size=20;
    if($_SESSION["box11"]==1){
    $sql="select count(*) as total from guanli where box5='1'";
	}elseif($_SESSION["box55"]==1){
	$sql="select count(*) as total from guanli where box5='1' and username='".$_SESSION["username2"]."' ";
	}elseif($_SESSION["box66"]==1){
	$sql="select count(*) as total from guanli where box5='1' and username='".$_SESSION["mastersalename2"]."'  ";
	}
	$result=mysql_query($sql);
    $message_count=mysql_result($result,0,"total");
    $page_count=ceil($message_count/$page_size);	
    $offset=($page-1)*$page_size;			 
    if($_SESSION["box11"]==1){
    $sql="select * from guanli where box5='1' order by id  limit $offset, $page_size";	
	}elseif($_SESSION["box55"]==1){
	$sql="select * from guanli where box5='1' and username='".$_SESSION["username2"]."'  order by id  limit $offset, $page_size";	
	}elseif($_SESSION["box66"]==1){
	$sql="select * from guanli where box5='1' and username='".$_SESSION["mastersalename2"]."' order by id  limit $offset, $page_size";	
	}			
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
	?>
	
	<?php if($_SESSION["box11"]==1){?>
        <tr bgcolor="#D0EFFF" > 
          <td width="182" height="22"><span class="STYLE1"><img src="images/tree_folder4.gif" width="15" height="15"><?php echo $row->username;?></span></td>
          <td align="center"><span class="STYLE1"><?php echo $row->password;?></span></td>
          <td align="center"><span class="STYLE1"><?php if($row->box5==1) {?>
                    <a href="?id=<?php echo $row->id;?>&box5=0&mastername=<?php echo urlencode($row->username);?>" > <font color="red">√</font></a>
                    <?php }else{?>
                    <b><a href="?id=<?php echo $row->id;?>&box5=1"><font color="black">×</font></a></b>
                    <?php }?></span></td>
          <td align="center"><span class="STYLE1"></span></td>
          <td align="center"><span class="STYLE1">
            </span></td>
          <td align="center">
		  <a href="admin-acc-s-main_xiugai.php?id=<?php echo $row->id;?>" ><span class="STYLE1">修改</span></a> 
    | <a href="?action=del&id=<?php echo $row->id;?>&deltype=master&mastername=<?php echo urlencode($row->username);?>"  onClick="return ConfirmDelBig();"><span class="STYLE1">刪除</span></a></td>
        </tr>
		<?php }?>
		
		
		
        <?php
		   $sql2="select * from guanli where box6='1' and mastersalename='".$row->username."'  order by id  ";			
	$result2=mysql_query($sql2);
	while ($row2=mysql_fetch_object($result2)){
	?>
	
	<?php if($_SESSION["box11"]==1 or $_SESSION["box55"]==1){?>
        <tr bgcolor="#EBFECB" > 
          <td width="182" height="22"><img src="images/tree_folder3.gif" width="15" height="15"><span class="STYLE1"><?php echo $row2->username;?></span></td>
          <td align="center"><span class="STYLE1"><?php echo $row2->username;?></span></td>
          <td align="center">&nbsp;</td>
          <td align="center"><?php if($row2->box6==1) {?>
                    <a href="?id=<?php echo $row2->id;?>&box6=0&salename=<?php echo urlencode($row2->username);?>" > <font color="red">√</font></a>
                    <?php }else{?>
                    <b><a href="?id=<?php echo $row2->id;?>&box6=1" ><font color="black"><font color="black">×</font></font></a></b>
                    <?php }?></td>
          <td align="center">&nbsp;</td>
          <td align="center">
		  <a href="admin-acc-s-main_xiugai.php?id=<?php echo $row2->id;?>" ><span class="STYLE1">修改</span></a> 
    | <a href="?action=del&id=<?php echo $row2->id;?>&deltype=sale&salename=<?php echo urlencode($row2->username);?>"  onClick="return ConfirmDelBig();"><span class="STYLE1">刪除</span></a></td>
        </tr>
		<?php }?>
		
		
		 <?php
		   $sql3="select * from guanli where box7='1' and mastersalename='".$row->username."' and salename='".$row2->username."'  order by id  ";			
	$result3=mysql_query($sql3);
	while ($row3=mysql_fetch_object($result3)){
	?>
        <tr bgcolor="#FDE6C4" > 
          <td width="182" height="22"><span class="STYLE1"><img src="images/tree_folder3.gif" width="15" height="15"><img src="images/tree_folder3.gif" width="15" height="15"><?php echo $row3->username;?></span></td>
          <td align="center"><span class="STYLE1"><?php echo $row3->password;?></span></td>
          <td align="center"><span class="STYLE1"></span></td>
          <td align="center"><span class="STYLE1"></span></td>
          <td align="center"><span class="STYLE1"><?php if($row3->box7==1) {?>
                    <a href="?id=<?php echo $row3->id;?>&box7=0" > <font color="red">√</font></a>
                    <?php }else{?>
                    <b><a href="?id=<?php echo $row3->id;?>&box7=1" ><font color="black"><font color="black">×</font></font></a></b>
                    <?php }?>
           </span></td>
          <td align="center">
		    <a href="admin-acc-s-main_xiugai.php?id=<?php echo $row3->id;?>" ><span class="STYLE1">修改</span></a> 
    | <a href="?action=del&id=<?php echo $row3->id;?>&deltype=design"  onClick="return ConfirmDelBig();"><span class="STYLE1">刪除</span></a></td>
        </tr>
        <?php }?>
		
		
        <?php }?>
		
		
		
		
		<?php }}?>
		 
		 <tr>
            <td height="100%" colspan="20" bgcolor="#CCCCFF" scope="col">
              <div align="center" class="STYLE1">總共&nbsp;<?php echo $message_count;?> 條記錄&nbsp;&nbsp;頁次：
			  <?php 
			  $BigClassName=$_GET["BigClassName"];
			  $BigClassName=urlencode($BigClassName);
			  if($page!=1)
				   {
				     echo  "<a href=?page=1&BigClassName=".$BigClassName.">首頁</a>&nbsp;&nbsp;&nbsp;";
					 echo "<a href=?page=".($page-1)."&BigClassName=".$BigClassName.">上一頁</a>&nbsp;&nbsp;&nbsp;";
				   } echo $page;?> / <?php echo $page_count;?> 页&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
       <?php
	  		  
				  if($page<$page_count)
				   {
				        echo "<a href=?page=".($page+1)."&BigClassName=".$BigClassName.">下一頁</a>&nbsp;&nbsp;&nbsp;";
				        echo  "<a href=?page=".$page_count."&BigClassName=".$BigClassName.">尾頁</a>&nbsp;&nbsp;&nbsp;&nbsp;";
				   
				   }
				   
				?>
                 &nbsp;&nbsp;&nbsp;跳轉到
                 <script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
                 <select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('self',this,0)">
                 
                 <?php 
				 for($i=1;$i<=$page_count;$i++){
				 ?>
                   <option value="?page=<?php echo $i;?>" <?php if($page==$i){echo "selected";}?>><?php echo $i;?></option>
                   <?php }?>
              </select>頁			  </div>            </td>
        </tr>
    </table>
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
   </div>
<div id="contact_page"></div>
</div><!-- main end //-->
</div><!--Wrap end //-->
<div id="botton">
 <?php include_once('admin_botton_btn.php');?>
</div>
</body>
</html>
